import http from '@/utils/http/axios'
import { LoginParams, LoginResultModel } from './model/userModel'
import { ContentTypeEnum } from '@/enums/httpEnum'

enum Api {
  login = '/user/login',
  logout = '/user/loginOut',
  resetPassword = '/user/resetPassword',
}

/**
 * @description: 企业用户登录
 */
export function login(params: LoginParams) {
  return http.request(
    {
      url: Api.login,
      method: 'GET',
      headers: {
        'Content-Type': ContentTypeEnum.JSON
      },
      params
    },
    {
      isTransformRequestResult: false,
    }
  )
}

/**
 * @description: 用户修改密码
 */
export function changePassword(params) {
  return http.request(
    {
      url: Api.resetPassword,
      method: 'POST',
      params
    },
    {
      successMessageText: '重置密码成功'
    }
  )
}

/**
 * @description: 用户登出
 */
export function logout(params) {
  return http.request({
    url: Api.logout,
    method: 'POST',
    params
  })
}
